from toee import *
from __main__ import game
from utilities import *
from Co8 import *
#from itt import *
from array import *
from py00439script_daemon import get_v, set_v, get_f, set_f, get_s, set_s

## Last update 2009 - 09 - 27	
			
def tgd(hp_desired, radius): #tough guy detector
	gladius = []
	for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC):
		if moshe.distance_to(game.party[0]) <= radius and moshe.stat_level_get(stat_hp_max) >= hp_desired:
			x,y = lta(moshe.location)
			gladius.append((moshe.name,'hp='+str(moshe.stat_level_get(stat_hp_max)),x,y))
	return gladius



def tbel():
	game.fade_and_teleport(0,0,0,5093, 481, 456)
	belsornig = game.obj_create(14193, lfa(494, 467))
	belsornig.obj_set_int(324, 71)
	merrolan = game.obj_create(14197, lfa(494, 469))
	merrolan.obj_set_int(324, 72)
	nalorrem = game.obj_create(14198, lfa(497, 465))
	nalorrem.obj_set_int(324, 73)


def engage(pcno):
	for clebsch in range(0,	43):
		game.party[pcno].scripts[clebsch] = 440


def vrs(var_s, var_e):
	bloke = []
	for snoike in [var_s, var_e+1]:
		bloke.append(game.global_vars[snoike])
	return bloke

def fnl(obj_name,radius):
	gladius = []
	for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC):
		if moshe.distance_to(game.party[0]) <= radius and moshe.name == obj_name:
			gladius.append(moshe)
	return gladius

def bsp(prot):
	a = game.obj_create(prot, game.leader.location)
	a.npc_flag_unset(ONF_KOS)	
	a.move(game.leader.location,0,0)
	return a

def killkos():
	for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC):
		if (moshe.npc_flags_get() & ONF_KOS != 0 and moshe.npc_flags_get() & ONF_KOS_OVERRIDE == 0 and moshe.scripts[22] == 0):
			moshe.critter_kill_by_effect()
	return

def vlist3(radius):
	gladius = []
	for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC):
		if moshe.distance_to(game.party[0]) <= radius:
			gladius.append(moshe)
	return gladius

def nxy(radius):
	gladius = []
	for moshe in game.obj_list_vicinity(game.leader.location, OLC_NPC):
		if moshe.distance_to(game.party[0]) <= radius:
			x,y = lta(moshe.location)
			gladius.append((moshe.name,x,y))
	return gladius


def hl(obj):
	#highlight the sucker
	game.particles('ef-minocloud', obj)
	return

def make_slow():
	for pc in game.party:
		pc.stat_base_set(stat_dexterity,4)
	return



def fl(flag_no):
	if game.global_flags[flag_no] == 0:
		game.global_flags[flag_no] = 1
	return game.global_flags[flag_no]

def vr(var_no):
	return game.global_vars[var_no]


def tyme():
	return (game.time.time_game_in_months(game.time), game.time.time_game_in_days(game.time), game.time.time_game_in_hours(game.time), game.time.time_game_in_minutes(game.time))


def gp( name):
	a = fnn( name )
	if a != OBJ_HANDLE_NULL:
		return a.obj_get_int(obj_f_npc_pad_i_5)
	else:
		return OBJ_HANDLE_NULL

def sp(name, num):
	a = fnn( name )
	if a != OBJ_HANDLE_NULL:
		a.obj_set_int(obj_f_npc_pad_i_5, num)
	else:
		return OBJ_HANDLE_NULL

def dof(obj): 
	## A handy little function to display an objects' object flags
	col_size = 10
	object_flags_list = ['OF_DESTROYED','OF_OFF','OF_FLAT','OF_TEXT','OF_SEE_THROUGH','OF_SHOOT_THROUGH','OF_TRANSLUCENT','OF_SHRUNK','OF_DONTDRAW','OF_INVISIBLE','OF_NO_BLOCK','OF_CLICK_THROUGH','OF_INVENTORY','OF_DYNAMIC','OF_PROVIDES_COVER','OF_RANDOM_SIZE','OF_NOHEIGHT','OF_WADING','OF_UNUSED_40000','OF_STONED','OF_DONTLIGHT','OF_TEXT_FLOATER','OF_INVULNERABLE','OF_EXTINCT','OF_TRAP_PC','OF_TRAP_SPOTTED','OF_DISALLOW_WADING','OF_UNUSED_0800000','OF_HEIGHT_SET','OF_ANIMATED_DEAD','OF_TELEPORTED','OF_RADIUS_SET']
	lista = []
	for p in range(0, 31):
		lista.append(''.join([ object_flags_list[p],' - ',str(obj.object_flags_get() & pow(2,p) != 0) ]))
	lista.append(''.join([ object_flags_list[31],' - ',str(obj.object_flags_get() & OF_RADIUS_SET != 0) ]))
	lenmax = 1
	for p in range(0,31):
		if len(lista[p]) > lenmax:
			lenmax = len(lista[p])
	##print 'lenmax = ',str(lenmax)
	print ''
	for p in range(0,col_size+1):
		len1 = len(''.join([ object_flags_list[p],' - ',str(obj.object_flags_get() & pow(2,p) != 0) ]))
		len2 = len(''.join([ object_flags_list[p+col_size+1],' - ',str(obj.object_flags_get() & pow(2,p+col_size+1) != 0) ]))
		if p >= col_size-1:
			hau = OF_RADIUS_SET
		else:
			hau = pow(2,p+2*col_size+2)
		har1 = ''
		har2 = ''
		for p1 in range(0, lenmax-len1+1):
			har1 += '  '
		for p2 in range(0, lenmax-len2+1):
			har2 += '   '
		if p < col_size:
			print ''.join([ object_flags_list[p],' - ',str(obj.object_flags_get() & pow(2,p) != 0) ]),har1,''.join([ object_flags_list[p+col_size+1],' - ',str(obj.object_flags_get() & pow(2,p+col_size+1) != 0) ]),har2,''.join([ object_flags_list[p+2*col_size+2],' - ',str(obj.object_flags_get() & hau != 0) ])
		else:
			print ''.join([ object_flags_list[p],' - ',str(obj.object_flags_get() & pow(2,p) != 0) ]),har1,''.join([ object_flags_list[p+col_size+1],' - ',str(obj.object_flags_get() & pow(2,p+col_size+1) != 0) ])


	return

def dnf(obj): 
	## A handy little function to display an objects' NPC flags
	col_size = 10
	npc_flags_list = ['ONF_EX_FOLLOWER','ONF_WAYPOINTS_DAY','ONF_WAYPOINTS_NIGHT','ONF_AI_WAIT_HERE','ONF_AI_SPREAD_OUT','ONF_JILTED','ONF_LOGBOOK_IGNORES','ONF_UNUSED_00000080','ONF_KOS','ONF_USE_ALERTPOINTS','ONF_FORCED_FOLLOWER','ONF_KOS_OVERRIDE','ONF_WANDERS','ONF_WANDERS_IN_DARK','ONF_FENCE','ONF_FAMILIAR','ONF_CHECK_LEADER','ONF_NO_EQUIP','ONF_CAST_HIGHEST','ONF_GENERATOR','ONF_GENERATED','ONF_GENERATOR_RATE1','ONF_GENERATOR_RATE2','ONF_GENERATOR_RATE3','ONF_DEMAINTAIN_SPELLS','ONF_UNUSED_02000000','ONF_UNUSED_04000000','ONF_UNUSED08000000','ONF_BACKING_OFF','ONF_NO_ATTACK','ONF_BOSS_MONSTER','ONF_EXTRAPLANAR']
	lista = []
	for p in range(0, 31):
		lista.append(''.join([ npc_flags_list[p],' - ',str(obj.npc_flags_get() & pow(2,p) != 0) ]))
	lista.append(''.join([ npc_flags_list[31],' - ',str(obj.npc_flags_get() & OF_RADIUS_SET != 0) ]))
	lenmax = 1
	for p in range(0,31):
		if len(lista[p]) > lenmax:
			lenmax = len(lista[p])
	##print 'lenmax = ',str(lenmax)
	print ''
	for p in range(0,col_size+1):
		len1 = len(''.join([ npc_flags_list[p],' - ',str(obj.npc_flags_get() & pow(2,p) != 0) ]))
		len2 = len(''.join([ npc_flags_list[p+col_size+1],' - ',str(obj.npc_flags_get() & pow(2,p+col_size+1) != 0) ]))
		if p >= col_size-1:
			hau = ONF_EXTRAPLANAR
		else:
			hau = pow(2,p+2*col_size+2)
		har1 = ''
		har2 = ''
		for p1 in range(0, lenmax-len1+1):
			har1 += '  '
		for p2 in range(0, lenmax-len2+1):
			har2 += '   '
		if p < col_size:
			print ''.join([ npc_flags_list[p],' - ',str(obj.npc_flags_get() & pow(2,p) != 0) ]),har1,''.join([ npc_flags_list[p+col_size+1],' - ',str(obj.npc_flags_get() & pow(2,p+col_size+1) != 0) ]),har2,''.join([ npc_flags_list[p+2*col_size+2],' - ',str(obj.npc_flags_get() & hau != 0) ])
		else:
			print ''.join([ npc_flags_list[p],' - ',str(obj.npc_flags_get() & pow(2,p) != 0) ]),har1,''.join([ npc_flags_list[p+col_size+1],' - ',str(obj.npc_flags_get() & pow(2,p+col_size+1) != 0) ])


	return


def te():
	#test earth temple stuff
	uberize()
	gimme_earth()
	earthaltar()
	return

def ta():
	#test air temple stuff
	game.global_flags[108] = 1 #makes water bugbears defect
	uberize()
	gimme_air()
	airaltar()
	return

def tw():
	#test water temple stuff
	uberize()
	gimme_water()
	belsornig()
	return



def t():
	uberize_minor()
	gimme()
	hommlet()
	return

def t2():
	uberize_minor()
	gimme_minor()
	hommlet()
	return

def uberize_minor():
	for pc in game.party:
		pc.stat_base_set(stat_strength,24)
		pc.stat_base_set(stat_constitution,140)
		pc.stat_base_set(stat_charisma,130)
		pc.stat_base_set(stat_dexterity,41)
		pc.stat_base_set(stat_wisdom,130)
		pc.stat_base_set(stat_intelligence,18)
	return


def uberize():
	for pc in game.party:
		pc.stat_base_set(stat_strength,130)
		pc.stat_base_set(stat_constitution,140)
		pc.stat_base_set(stat_charisma,130)
		pc.stat_base_set(stat_dexterity,130)
		pc.stat_base_set(stat_wisdom,130)
		pc.stat_base_set(stat_intelligence,18)
	return

def gimme_minor():
	for pc in game.party:
		if pc.item_find_by_proto(6105) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6015, pc )
		if pc.item_find_by_proto(6109) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6109, pc )
		if pc.item_find_by_proto(6110) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6110, pc )
		if pc.item_find_by_proto(6111) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6111, pc )
		if pc.item_find_by_proto(6112) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6112, pc )
		if pc.item_find_by_proto(6113) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6113, pc )
## the above are temple robes and eye of flame cloak
		if pc.item_find_by_proto(12262) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12262, pc )
		create_item_in_inventory( 6266, pc )
		create_item_in_inventory( 6101, pc )
		create_item_in_inventory( 6115, pc )
		create_item_in_inventory( 5013, pc )
		create_item_in_inventory( 4085, pc )
		studded_leather = 0
		if pc.item_find_by_proto(6056) != OBJ_HANDLE_NULL:
			pc.item_find_by_proto(6056).destroy()
			studded_leather = 1

		pc.item_wield_best_all()

		if studded_leather == 1:
			create_item_in_inventory(6056, pc)
		if pc.item_find_by_proto(4177) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 4177, pc ) 
## masterwork light xbow
		pc.identify_all()


def gimme():
	for pc in game.party:
		if pc.item_find_by_proto(6105) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6015, pc )
		if pc.item_find_by_proto(6109) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6109, pc )
		if pc.item_find_by_proto(6110) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6110, pc )
		if pc.item_find_by_proto(6111) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6111, pc )
		if pc.item_find_by_proto(6112) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6112, pc )
		if pc.item_find_by_proto(6113) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6113, pc )
## the above are temple robes and eye of flame cloak
		if pc.item_find_by_proto(12262) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12262, pc )
		create_item_in_inventory( 6266, pc )
		create_item_in_inventory( 6101, pc )
		create_item_in_inventory( 6115, pc )
		if pc.item_find_by_proto(4219) == OBJ_HANDLE_NULL and pc.item_find_by_proto(4118) == OBJ_HANDLE_NULL:
			if not ( pc.stat_level_get(stat_alignment) == LAWFUL_EVIL or pc.stat_level_get(stat_alignment) == NEUTRAL_EVIL or pc.stat_level_get(stat_alignment) == CHAOTIC_EVIL):
				create_item_in_inventory( 4219, pc )
			else:
				create_item_in_inventory( 4118, pc )
		create_item_in_inventory( 5013, pc )
		create_item_in_inventory( 4085, pc )
## weapons and armor: xbow, holy ranseur, bolts+3, bracers+5, amulet+5, longsword+5, fire res

		studded_leather = 0
		if pc.item_find_by_proto(6056) != OBJ_HANDLE_NULL:
			pc.item_find_by_proto(6056).destroy()
			studded_leather = 1

		pc.item_wield_best_all()

		if studded_leather == 1:
			create_item_in_inventory(6056, pc)
		if pc.item_find_by_proto(4177) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 4177, pc ) 
## masterwork light xbow
		pc.identify_all()

	return

def gimme_earth():
	for pc in game.party:
		if pc.item_find_by_proto(6105) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6015, pc )
		if pc.item_find_by_proto(6110) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6110, pc )
## the above are earth temple robes and ring of freedom of movement
		if pc.item_find_by_proto(12262) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12262, pc )
#wand of knock
		if pc.item_find_by_proto(12620) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12620, pc )
#wand of fireball (10th level)
		create_item_in_inventory( 6266, pc )
		create_item_in_inventory( 6101, pc )
		create_item_in_inventory( 6115, pc )
		if pc.item_find_by_proto(4219) == OBJ_HANDLE_NULL and pc.item_find_by_proto(4118) == OBJ_HANDLE_NULL:
			if not ( pc.stat_level_get(stat_alignment) == LAWFUL_EVIL or pc.stat_level_get(stat_alignment) == NEUTRAL_EVIL or pc.stat_level_get(stat_alignment) == CHAOTIC_EVIL):
				create_item_in_inventory( 4219, pc )
			else:
				create_item_in_inventory( 4118, pc )
		create_item_in_inventory( 5013, pc )
		create_item_in_inventory( 4085, pc )
## weapons and armor: xbow, holy ranseur, bolts+3, bracers+5, amulet+5, longsword+5, fire res
		studded_leather = 0
		if pc.item_find_by_proto(6056) != OBJ_HANDLE_NULL:
			pc.item_find_by_proto(6056).destroy()
			studded_leather = 1

		pc.item_wield_best_all()

		if studded_leather == 1:
			create_item_in_inventory(6056, pc)
		if pc.item_find_by_proto(4177) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 4177, pc ) 
## masterwork light xbow
		pc.identify_all()

	return

def gimme_air():
	for pc in game.party:
		if pc.item_find_by_proto(6105) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6015, pc )
		if pc.item_find_by_proto(6110) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6109, pc )
## the above are air temple robes and ring of freedom of movement
		if pc.item_find_by_proto(12262) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12262, pc )
#wand of knock
		if pc.item_find_by_proto(12620) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12620, pc )
#wand of fireball (10th level)
		create_item_in_inventory( 6266, pc )
		create_item_in_inventory( 6101, pc )
		create_item_in_inventory( 6115, pc )
		if pc.item_find_by_proto(4219) == OBJ_HANDLE_NULL and pc.item_find_by_proto(4118) == OBJ_HANDLE_NULL:
			if not ( pc.stat_level_get(stat_alignment) == LAWFUL_EVIL or pc.stat_level_get(stat_alignment) == NEUTRAL_EVIL or pc.stat_level_get(stat_alignment) == CHAOTIC_EVIL):
				create_item_in_inventory( 4219, pc )
			else:
				create_item_in_inventory( 4118, pc )
		create_item_in_inventory( 5013, pc )
		create_item_in_inventory( 4085, pc )
## weapons and armor: xbow, holy ranseur, bolts+3, bracers+5, amulet+5, longsword+5, fire res

		studded_leather = 0
		if pc.item_find_by_proto(6056) != OBJ_HANDLE_NULL:
			pc.item_find_by_proto(6056).destroy()
			studded_leather = 1

		pc.item_wield_best_all()

		if studded_leather == 1:
			create_item_in_inventory(6056, pc)
		if pc.item_find_by_proto(4177) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 4177, pc ) 
## masterwork light xbow
		pc.identify_all()

	return

def gimme_water():
	for pc in game.party:
		if pc.item_find_by_proto(6105) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6015, pc )  ##ring of freedom of movement
		if pc.item_find_by_proto(6110) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 6112, pc )  ##water temple robes
		if pc.item_find_by_proto(12262) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12262, pc ) ##wand of knock
		if pc.item_find_by_proto(12620) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 12620, pc )  ##wand of fireball (10th level)
		create_item_in_inventory( 6266, pc ) ##amulet of natural armor +5
		create_item_in_inventory( 6101, pc ) ##minor ring of fire res
		create_item_in_inventory( 6115, pc ) ##bracers of armor +5
		if pc.item_find_by_proto(4219) == OBJ_HANDLE_NULL and pc.item_find_by_proto(4118) == OBJ_HANDLE_NULL:
			if not ( pc.stat_level_get(stat_alignment) == LAWFUL_EVIL or pc.stat_level_get(stat_alignment) == NEUTRAL_EVIL or pc.stat_level_get(stat_alignment) == CHAOTIC_EVIL):
				create_item_in_inventory( 4219, pc ) ##holy ranseur
			else:
				create_item_in_inventory( 4118, pc ) ##ordinary glaive for evil PCs
		create_item_in_inventory( 5013, pc ) ##bolts +3
		create_item_in_inventory( 4085, pc ) ##longsword +5

		studded_leather = 0
		if pc.item_find_by_proto(6056) != OBJ_HANDLE_NULL:
			pc.item_find_by_proto(6056).destroy()
			studded_leather = 1

		pc.item_wield_best_all()

		if studded_leather == 1:
			create_item_in_inventory(6056, pc)
		if pc.item_find_by_proto(4177) == OBJ_HANDLE_NULL:
			create_item_in_inventory( 4177, pc ) ##masterwork light xbow
		pc.identify_all()

	return


def s(prot):
	(x,y) = lta(game.leader.location)
	a = spawn(prot,x,y+1)
	return a


def det():
	return (game.party[0].map, loc())




def tp(map,X,Y):
	game.fade_and_teleport(0,0,0,map,X,Y)
	return

def loc():
	return location_to_axis(game.party[0].location)

def lfa( x, y ):
	# initialize loc to be a LONG integer
	loc = 0L + y
	loc = ( loc << 32 ) + x
	return loc

def lta( loc ):
	y = loc >> 32
	x = loc & 4294967295
	return ( x, y )

def lvl():  # CB - sets entire groups experience points to xp
	pc = game.leader
	for obj in pc.group_list():
		curxp = obj.stat_level_get(stat_experience)
		newxp = curxp + 600000
		obj.stat_base_set(stat_experience, newxp)
	return 	1

def fnn( name ):
	for npc in game.obj_list_vicinity( game.leader.location, OLC_NPC ):
		if (npc.name == name):
			return npc
	return OBJ_HANDLE_NULL

def vlist():
	moshe = game.obj_list_vicinity(game.leader.location, OLC_NPC)
	return moshe

def vlist2():
	# looks for nearby containers
	moshe = game.obj_list_vicinity(game.leader.location, OLC_CONTAINER)
	return moshe


def spawn(prot,x,y):
	moshe = game.obj_create(prot,lfa(x,y))
	if (moshe != OBJ_HANDLE_NULL):
		return moshe
	return OBJ_HANDLE_NULL

def alldie():
	for obj in game.obj_list_vicinity( game.party[0].location, OLC_CRITTERS ):
		if obj not in game.party and obj.name != 14455:
			obj.critter_kill_by_effect()
			# damage_dice = dice_new( '104d20' )
			# obj.damage( OBJ_HANDLE_NULL, 0, damage_dice )
	return 1

def speedup():
	for pc in game.party:
		pc.obj_set_int(obj_f_speed_run, 1070353216)
		game.particles( 'Orb-Summon-Air-Elemental', pc )
	return

## -------------------------------------
## TELEPOR SHORTCUTS
## -------------------------------------

# HOMMLET
def homm():
	game.fade_and_teleport(0,0,0,5001,619,422)
	return
def hommlet():
	game.fade_and_teleport(0,0,0,5001,619,422)
	return
def smith():
	game.fade_and_teleport(0,0,0,5001,577,433)
	return
def spugnoir():
	game.fade_and_teleport(0,0,0,5007,475,482)
	return
def courier():
	game.fade_and_teleport(0,0,0,5009,479,483)
	return
def templeagent(): #the courier
	game.fade_and_teleport(0,0,0,5009,479,483)
	return
def traders():
	game.fade_and_teleport(0,0,0,5010,482,480)
	return
def rannos():
	game.fade_and_teleport(0,0,0,5010,482,480)
	return
def gremag():
	game.fade_and_teleport(0,0,0,5010,482,480)
	return
def rannosdavl():
	game.fade_and_teleport(0,0,0,5010,482,480)
	return
def terjon():
	game.fade_and_teleport(0,0,0,5011,486,480)
	return
def calmert():
	game.fade_and_teleport(0,0,0,5012,491,484)
	return
def burne():
	game.fade_and_teleport(0,0,0,5016,479,482)
	return
def rufus():
	game.fade_and_teleport(0,0,0,5016,479,482)
	return
def percy():
	game.fade_and_teleport(0,0,0,5020,478,481)
	return
def tarim():
	game.fade_and_teleport(0,0,0,5022,482,481)
	return
def mathilde():
	game.fade_and_teleport(0,0,0,5023,468,484)
	return
def meleny():
	game.fade_and_teleport(0,0,0,5025,485,489)
	return
def althea():
	game.fade_and_teleport(0,0,0,5025,485,489)
	return
def filliken():
	game.fade_and_teleport(0,0,0,5025,485,489)
	return
def bing():
	game.fade_and_teleport(0,0,0,5026,491,487)
	return
def tenants():
	game.fade_and_teleport(0,0,0,5029,485,491)
	return
def jinnerth():
	game.fade_and_teleport(0,0,0,5030,488,484)
	return
def brewhouse():
	game.fade_and_teleport(0,0,0,5037,475,479)
	return
def cavanaugh():
	game.fade_and_teleport(0,0,0,5037,475,479)
	return
def deklo():
	game.fade_and_teleport(0,0,0,5069,480,480)
	return
def inn():
	game.fade_and_teleport(0,0,0,5007,483,480)
	return
def welcomewench():
	game.fade_and_teleport(0,0,0,5007,483,480)
	return
def furnok():
	game.fade_and_teleport(0,0,0,5007,476,478)
	return
def ostler():
	game.fade_and_teleport(0,0,0,5007,482,477)
	return
def gundigoot():
	game.fade_and_teleport(0,0,0,5007,482,477)
	return
def gundi():
	game.fade_and_teleport(0,0,0,5007,482,477)
	return
def innkeeper():
	game.fade_and_teleport(0,0,0,5007,482,477)
	return
def castle():
	game.fade_and_teleport(0,0,0,5001,437,698)
	return
def constructionsite():
	game.fade_and_teleport(0,0,0,5001,437,698)
	return
def castleconstructionsite():
	game.fade_and_teleport(0,0,0,5001,437,698)
	return
def jayfie():
	if is_daytime():
		game.fade_and_teleport(0,0,0,5001,437,698)
	else:
		jayfienight()
	return
def laborerspy():
	if is_daytime():
		game.fade_and_teleport(0,0,0,5001,437,698)
	else:
		jayfienight()
	return
def spy():
	if is_daytime():
		game.fade_and_teleport(0,0,0,5001,437,698)
	else:
		jayfienight()
	return
def jayfienight():
	game.fade_and_teleport(0,0,0,5001,383,519)
	return
def yvy():
	game.fade_and_teleport(0,0,0,5001,370,533)
	return
def tatooartist():
	game.fade_and_teleport(0,0,0,5001,370,533)
	return
def tatoo():
	game.fade_and_teleport(0,0,0,5001,370,533)
	return
def campmother():
	game.fade_and_teleport(0,0,0,5001,370,533)
	return
def laborercook():
	game.fade_and_teleport(0,0,0,5001,402,533)
	return
def dex():
	game.fade_and_teleport(0,0,0,5001,402,533)
	return
def elder():
	game.fade_and_teleport(0,0,0,5045,482,477)
	return
def nevets():
	game.fade_and_teleport(0,0,0,5045,482,477)
	return
def kenternevets():
	game.fade_and_teleport(0,0,0,5045,482,477)
	return
def villageelder():
	game.fade_and_teleport(0,0,0,5045,482,477)
	return
def townelder():
	game.fade_and_teleport(0,0,0,5045,482,477)
	return
def kenter():
	game.fade_and_teleport(0,0,0,5045,482,477)
	return
def carpenter():
	game.fade_and_teleport(0,0,0,5047,476,471)
	return
def riklinkin():
	game.fade_and_teleport(0,0,0,5047,476,471)
	return
def marek():
	game.fade_and_teleport(0,0,0,5047,476,471)
	return
def barnmaker():
	game.fade_and_teleport(0,0,0,5047,476,471)
	return
def wainwright():
	if is_daytime():
		game.fade_and_teleport(0,0,0,5044,494,487)
	else:
		inn()
	return
def valden():
	if is_daytime():
		game.fade_and_teleport(0,0,0,5044,494,487)
	else:
		inn()
	return
def stonemason():
	game.fade_and_teleport(0,0,0,5001,455,520)
	return
def mason():
	game.fade_and_teleport(0,0,0,5001,455,520)
	return
def gister():
	game.fade_and_teleport(0,0,0,5001,455,520)
	return
def gisternoshim():
	game.fade_and_teleport(0,0,0,5001,455,520)
	return
def jay():
	if is_daytime():
		game.fade_and_teleport(0,0,0,5001,540,249)
	else:
		game.fade_and_teleport(0,0,0,5038,487,485)
	return
def blackjay():
	if is_daytime():
		game.fade_and_teleport(0,0,0,5001,540,249)
	else:
		game.fade_and_teleport(0,0,0,5038,487,485)
	return
def teamster():
	game.fade_and_teleport(0,0,0,5032,474,482)
	return
def sef():
	game.fade_and_teleport(0,0,0,5032,474,482)
	return
def sefflettner():
	game.fade_and_teleport(0,0,0,5032,474,482)
	return
def teamsterson():
	if is_daytime() == 0 and game.global_flags[4] == 0:
		game.fade_and_teleport(0,0,0,5001,561,225)
	else:
		game.fade_and_teleport(0,0,0,5032,471,485)
	return
def corl():
	if is_daytime() == 0 and game.global_flags[4] == 0:
		game.fade_and_teleport(0,0,0,5001,561,225)
	else:
		game.fade_and_teleport(0,0,0,5032,471,485)
	return
def jaroo():
	game.fade_and_teleport(0,0,0,5042,491,474)
	return
def druid():
	game.fade_and_teleport(0,0,0,5042,491,474)
	return
def hall():
	game.fade_and_teleport(0,0,0,5001,577,410)
	return
def townhall():
	game.fade_and_teleport(0,0,0,5001,577,410)
	return
def council():
	game.fade_and_teleport(0,0,0,5001,577,410)
	return
def prison():
	game.fade_and_teleport(0,0,0,5014,482,478)	
	return
def chase():
	game.fade_and_teleport(0,0,0,5001,344,498)	
	return
def trail():
	game.fade_and_teleport(0,0,0,5001,344,498)
	return



## MOATHOUSE
def moathouse():
	game.fade_and_teleport(0,0,0,5002,480,546)
	return
def moatgate():
	game.fade_and_teleport(0,0,0,5002,487,485)
	return
def moathousegate():
	game.fade_and_teleport(0,0,0,5002,487,485)
	return
def moattower():
	game.fade_and_teleport(0,0,0,5003,471,486)
	return
def moathousetower():
	game.fade_and_teleport(0,0,0,5003,471,486)
	return
def lubash():
	game.fade_and_teleport(0,0,0,5005,425,415)
	return
def moatlevel1():
	game.fade_and_teleport(0,0,0,5004,476,477)
	return
def moatbugbears():
	game.fade_and_teleport(0,0,0,5005,444,499)
	return
def moatgnolls():
	game.fade_and_teleport(0,0,0,5005,509,503)
	return
def moathousegnolls():
	game.fade_and_teleport(0,0,0,5005,509,503)
	return
def moatsarge():
	game.fade_and_teleport(0,0,0,5005,536,547)
	return
def moathousesarge():
	game.fade_and_teleport(0,0,0,5005,536,547)
	return
def lareth():
	game.fade_and_teleport(0,0,0,5005,475,546)
	return

# NULB
def nulb():
	game.fade_and_teleport(0,0,0,5051,505,367)
	return
def imeryds():
	game.fade_and_teleport(0,0,0,5068,477,482)
	return
def otis():
	game.fade_and_teleport(0,0,0,5051,467,527)
	return
def mary():
	game.fade_and_teleport(0,0,0,5058,502,479)
	return
def riana():
	game.fade_and_teleport(0,0,0,5058,498,489)
	return
def ophelia():
	game.fade_and_teleport(0,0,0,5057,488,489)
	return
def madamophelia():
	game.fade_and_teleport(0,0,0,5057,488,489)
	return
def madam():
	game.fade_and_teleport(0,0,0,5057,488,489)
	return
def brothel():
	game.fade_and_teleport(0,0,0,5057,488,489)
	return
def snakepit():
	game.fade_and_teleport(0,0,0,5057,488,489)
	return
def serena():
	game.fade_and_teleport(0,0,0,5051,558,529)
	return
def sammy():
	game.fade_and_teleport(0,0,0,5051,495,525)
	return
def mona():
	game.fade_and_teleport(0,0,0,5051,558,536)
	return
def charlotte():
	game.fade_and_teleport(0,0,0,5058,494,473)
	return
def jenelda():
	game.fade_and_teleport(0,0,0,5059,483,480)
	return
def boatmanstavern():
	game.fade_and_teleport(0,0,0,5051,399,522)
	return
def tavern():
	game.fade_and_teleport(0,0,0,5051,399,522)
	return
def skole():
	game.fade_and_teleport(0,0,0,5052,477,489)
	return
def lodriss():
	game.fade_and_teleport(0,0,0,5052,472,482)
	return
def tolub():
	game.fade_and_teleport(0,0,0,5052,480,479)
	return
def grud():
	game.fade_and_teleport(0,0,0,5051,382,483)
	return
def grudsquinteye():
	game.fade_and_teleport(0,0,0,5051,382,483)
	return
def docks():
	game.fade_and_teleport(0,0,0,5051,382,483)
	return
def nulbdocks():
	game.fade_and_teleport(0,0,0,5051,382,483)
	return
def prestonwetz():
	game.fade_and_teleport(0,0,0,5051,478,470)
	return
def residentialarea():
	game.fade_and_teleport(0,0,0,5051,478,470)
	return
def nulbresidentialarea():
	game.fade_and_teleport(0,0,0,5051,478,470)
	return
def nulbhouse():
	game.fade_and_teleport(0,0,0,5051,478,470)
	return
def nulbhouses():
	game.fade_and_teleport(0,0,0,5051,478,470)
	return
def preston():
	game.fade_and_teleport(0,0,0,5051,478,470)
	return
def wetz():
	game.fade_and_teleport(0,0,0,5051,478,470)
	return
def hostel():
	game.fade_and_teleport(0,0,0,5051,556,453)
	return
def watersidehostel():
	game.fade_and_teleport(0,0,0,5051,556,453)
	return
def waterside():
	game.fade_and_teleport(0,0,0,5051,556,453)
	return
def alira():
	game.fade_and_teleport(0,0,0,5060,477,503)
	return
def pearl():
	game.fade_and_teleport(0,0,0,5060,479,500)
	return
def dala():
	game.fade_and_teleport(0,0,0,5060,477,503)
	return
def rentsch():
	game.fade_and_teleport(0,0,0,5060,478,493)
	return
def wat():
	game.fade_and_teleport(0,0,0,5060,481,493)
	return
def motherscreng():
	game.fade_and_teleport(0,0,0,5053,483,484)
	return
def screng():
	game.fade_and_teleport(0,0,0,5053,483,484)
	return
def ydey():
	game.fade_and_teleport(0,0,0,5053,483,484)
	return
def herbshop():
	game.fade_and_teleport(0,0,0,5053,483,484)
	return
def murfles():
	game.fade_and_teleport(0,0,0,5054,477,487)
	return
def hruda():
	game.fade_and_teleport(0,0,0,5054,477,487)
	return



# TEMPLE
def littlesttroll():
	game.fade_and_teleport(0,0,0,5067,475,397)
	return
def lvl2bugbears():
	game.fade_and_teleport(0,0,0,5067,423,405)
	return
def feldrin():
	game.fade_and_teleport(0,0,0,5067,524,454)
	return
def brunk():
	game.fade_and_teleport(0,0,0,5067,524,454)
	return
def oohlgrist():
	game.fade_and_teleport(0,0,0,5067,473,612)
	return
def aern():
	game.fade_and_teleport(0,0,0,5067,465,562)
	return
def bassanio():
	game.fade_and_teleport(0,0,0,5067,433,540)
	return
def tillahi():
	game.fade_and_teleport(0,0,0,5067,413,439)
	return
def alrrem(): 
	#   this is the proper spelling...
	game.fade_and_teleport(0,0,0,5067,416,499)
	return
def allrem(): 
	#   ... but for the sake of convenience...
	game.fade_and_teleport(0,0,0,5067,416,499)
	return
def tubal():
	game.fade_and_teleport(0,0,0,5067,416,499)
	return
def antonio():
	game.fade_and_teleport(0,0,0,5067,416,499)
	return
def werewolves():
	game.fade_and_teleport(0,0,0,5067,464,482)
	return
def belsornig():
	game.fade_and_teleport(0,0,0,5067,534,518)
	return
def kelno():
	game.fade_and_teleport(0,0,0,5067,524,484)
	return
def minotaur():
	game.fade_and_teleport(0,0,0,5067,568,382)
	return
def templelevel2():
	game.fade_and_teleport(0,0,0,5067,568,382)
	return
def templestaircase():
	game.fade_and_teleport(0,0,0,5064,480,484)
	return
def secretstaircase():
	game.fade_and_teleport(0,0,0,5064,480,484)
	return
def staircase():
	game.fade_and_teleport(0,0,0,5064,480,484)
	return
def stairs():
	game.fade_and_teleport(0,0,0,5064,480,484)
	return
def temple():
	game.fade_and_teleport(0,0,0,5064,480,484)
	return
def templelevel0():
	game.fade_and_teleport(0,0,0,5064,480,484)
	return
def morgan():
	game.fade_and_teleport(0,0,0,5066,553,567)
	return
def earthcommander():
	game.fade_and_teleport(0,0,0,5066,450,462)
	return
def romag():
	game.fade_and_teleport(0,0,0,5066,460,448)
	return
def wonnilonhideout():
	game.fade_and_teleport(0,0,0,5066,417,381)
	return
def hideout():
	game.fade_and_teleport(0,0,0,5066,417,381)
	return
def wonnilon():
	game.fade_and_teleport(0,0,0,5066,551,423)
	return
def earthaltar():
	game.fade_and_teleport(0,0,0,5066,471,387)
	return
def turnkey():
	game.fade_and_teleport(0,0,0,5066,541,453)
	return
def harpies():
	game.fade_and_teleport(0,0,0,5066,424,557)
	return
def thrommel():
	game.fade_and_teleport(0,0,0,5140,554,449)
	return
def leucrottas():
	game.fade_and_teleport(0,0,0,5140,423,590)
	return
def lamia():
	game.fade_and_teleport(0,0,0,5140,603,608)
	return
def whitman():
	game.fade_and_teleport(0,0,0,5140,420,571)
	return
def mandy():
	game.fade_and_teleport(0,0,0,5140,420,571)
	return
def smigmal():
	game.fade_and_teleport(0,0,0,5140,632,470)
	return
def falrinth():
	game.fade_and_teleport(0,0,0,5140,632,470)
	return
def scorpp():
	game.fade_and_teleport(0,0,0,5140,553,490)
	return
def templelevel4():
	game.fade_and_teleport(0,0,0,5080,481,580)
	return
def kella():
	game.fade_and_teleport(0,0,0,5080,538,612)
	return
def paida():
	game.fade_and_teleport(0,0,0,5080,594,539)
	return
def deggum():
	game.fade_and_teleport(0,0,0,5080,421,535)
	return
def senshock():
	game.fade_and_teleport(0,0,0,5080,376,547)
	return
def hedrack():
	game.fade_and_teleport(0,0,0,5080,479,471)
	return
def zuggtmoy():
	game.fade_and_teleport(0,0,0,5079,541,503)
	return
def gemthrone():
	game.fade_and_teleport(0,0,0,5079,574,480)
	return
def emridygiant():
	game.fade_and_teleport(0,0,0,5094,611,513)
	return
def rainbowrock():
	game.fade_and_teleport(0,0,0,5094,487,503)
	return
def emridy():
	game.fade_and_teleport(0,0,0,5094,544,411)
	return
def cave():
	game.fade_and_teleport(0,0,0,5095,473,517)
	return
def templetower():
	game.fade_and_teleport(0,0,0,5138,485,507)
	return
def earthtemple():
	game.fade_and_teleport(0,0,0,5066,524,564)
	return
def templelevel1():
	game.fade_and_teleport(0,0,0,5066,524,564)
	return
def ogrechief():
	game.fade_and_teleport(0,0,0,5066,484,535)
	return
def earthogrechief():
	game.fade_and_teleport(0,0,0,5066,484,535)
	return
def gnollleader():
	game.fade_and_teleport(0,0,0,5066,484,535)
	return
def airaltar():
	game.fade_and_teleport(0,0,0,5067,495,499)
	return


# NODES
def airnode():
	game.fade_and_teleport(0,0,0,5081,480,480)
	return
def ashrem():
	game.fade_and_teleport(0,0,0,5081,538,396)
	return
def taki():
	game.fade_and_teleport(0,0,0,5081,417,553)
	return
def vrock():
	game.fade_and_teleport(0,0,0,5081,411,398)
	return
def firenode():
	game.fade_and_teleport(0,0,0,5083,503,496)
	return
def darley():
	game.fade_and_teleport(0,0,0,5083,569,529)
	return
def balor():
	game.fade_and_teleport(0,0,0,5083,455,387)
	return
def waternode():
	game.fade_and_teleport(0,0,0,5084,523,474)
	return
def hezrou():
	game.fade_and_teleport(0,0,0,5084,419,447)
	return
def grank():
	game.fade_and_teleport(0,0,0,5084,520,484)
	return
def earthnode():
	game.fade_and_teleport(0,0,0,5082,483,472)
	return
def jaer():
	game.fade_and_teleport(0,0,0,5082,438,549)
	return
def sargen():
	game.fade_and_teleport(0,0,0,5082,415,481)
	return





def mickey():
	game.fade_and_teleport(0,0,0,5051,556,472)
	return
